package org.example.pack1209;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class DemoC {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.cj.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/2411";
        String user = "root";
        String password = "123456";
        Connection conn = DriverManager.getConnection(url, user, password);
        String sql = "update emp set enname=?,job=?,mgr=?,hiredate=now(),sal=sal-10 where empno=?";
        PreparedStatement ps = conn.prepareStatement(sql);
        ps.setString(1, "卢东东");
        ps.setString(2, "程序员");
        ps.setInt(3, 7996);
        ps.setInt(4, 7982);
        int row = ps.executeUpdate();
        System.out.println(row);
        ps.close();
        conn.close();
    }
}